
import { type DirectiveBinding } from 'vue';  
import {ElMessage} from 'element-plus'  
export default {  
  beforeMount(el: HTMLElement, binding: DirectiveBinding) {  
    el.addEventListener('click', () => {  
      const btn_text = document.getElementById('btn_text')
      console.log(el,'el')
      const textToCopy = btn_text.value;  
      navigator.clipboard.writeText(textToCopy).then(() => {  
        ElMessage.success('复制成功')
      }).catch(err => {  
        console.error('Failed to copy text: ', err);  
         ElMessage.error('复制失败')
      });  
    });  
  },  
  unmounted(el: HTMLElement) {  
    el.removeEventListener('click', () => {});  
  },  
};